package com.dalin.demo.service.imple;

import com.dalin.demo.dao.StudentCourseMapper;
import com.dalin.demo.pojo.entity.StudentCourse;
import com.dalin.demo.service.StudentCourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentCourseServiceImpl implements StudentCourseService {
    @Autowired
    private StudentCourseMapper studentCourseMapper;

    @Override
    public void batchAddStudentCourses(List<StudentCourse> studentCourses) {
        studentCourseMapper.batchInsert(studentCourses);
    }

    @Override
    public List<StudentCourse> getEnrolledStudentsByCourseId(Long courseId) {
        return studentCourseMapper.findStudentsByCourseId(courseId);
    }

    public Integer deleteStudent(int id) {
        studentCourseMapper.deleteStudentById(id);
        return id;
    }
} 